package com.haixiaoke.saas.workOrder.state.server;

import com.haixiaoke.saas.workOrder.domain.WorkOrderPerson;
import com.haixiaoke.saas.workOrder.domain.WorkOrderRecord;

/**
 * 工单类型服务方接口
 *
 * @Author panda
 * @Date 2024/9/3
 **/
public interface IWorkOrderTypeServerRole {

    /**
     * 新增工单
     * @return
     */
    int insertWorkOrder(String phone);

    /**
     * 驳回工单、作废工单
     *
     * @param workOrderRecord 工单跟进记录
     * @param userName        企业端操作人用户名
     * @param flatUserName    C端操作人用户名
     * @return
     */
    int rejectWorkOrder(WorkOrderRecord workOrderRecord, String userName, String flatUserName);

    /**
     * 派单、改派工单
     *
     * @param workOrderPerson 维修员
     * @return
     */
    int dispatchWorkOrder(WorkOrderPerson workOrderPerson);

    /**
     * 接单
     *
     * @param workOrderRecord     跟进记录
     * @param busUserId           维修员id
     * @param maintenanceTenantId 维修员的租户id
     * @return
     */
    int receivedWorkOrder(WorkOrderRecord workOrderRecord, Long busUserId, String maintenanceTenantId);


    /**
     * 支付完成
     *
     * @param record
     * @return
     */
    int paymentCompletion(WorkOrderRecord record);

    /**
     * 申请拒接
     *
     * @param workOrderRecord     工单跟进记录
     * @param busUserId           维修员id
     * @param maintenanceTenantId 维修员的租户id
     * @return
     */
    int requestRejectionWorkOrder(WorkOrderRecord workOrderRecord, Long busUserId, String maintenanceTenantId);

    /**
     * 同意拒接
     * @param workOrderRecord    工单跟进记录
     * @param username           操作人用户名
     * @return
     */
    int auditDenialWorkOrder(WorkOrderRecord workOrderRecord, String username);

    /**
     * 编辑已接单、处理中工单
     * @return
     */
    int beingRepaired();

    /**
     * 提交缴费单
     * @return
     */
    int submitPaymentSlip();

    /**
     * 工单人员撤销拒接申请
     * @param workOrderRecord       工单跟进记录
     * @param busUserId             维修员id
     * @param maintenanceTenantId   维修员的租户id
     * @return
     */
    int revocationRejectionWorkOrder(WorkOrderRecord workOrderRecord, Long busUserId, String maintenanceTenantId);

    /**
     * 申请临时密码
     */
    void applyTemporaryPassword(String name, String phone,Long busUserId);

    /**
     * 更新工单
     * @param phone
     * @return
     */
    int updateWorkOrder(String phone);

    /**
     * 确认已看房
     * @param userId    工单人员id
     * @param tenantId  工单人员租户id
     * @return
     */
    int confirmLookHouse(Long userId, String tenantId);
}
